import torch

# 四则运算
# 加法运算


# a = torch.rand(2, 3)
# b = torch.rand(2, 3)

# print(a)
# print(b)
# print(a + b)
# print(a.add(b))
# print(torch.add(a, b))

# print(a * b)
# print(torch.mul(a, b))
# print(a.mul(b))
# print(a.mul_(b))

# a = torch.ones(1, 2, 3, 4)
# b = torch.ones(1, 2, 4, 3)

# print(torch.mm(a, b))
# print(a.matmul(b))
# print(torch.matmul(a, b))

a = torch.rand(2, 2)
a = a * 10
print(a)

print(torch.floor(a)) # 向下取整
print(torch.ceil(a)) # 向上取整
print(torch.round(a)) # 四舍五入
print(torch.trunc(a)) # 四整数部分
print(torch.frac(a)) # 取小数部分
print(a % 2) # 取余
